from Base import message, intersect, SS_VALID
from DRG import MDCI_DRG

def group(record):
  adrg_zd = ["C41.200x005","C41.201","C41.202","C41.203","C41.400x008","C41.400x009","C41.401","C41.402","C41.403","C41.404","C41.406","C41.800x001","C49.500","C49.500x001","C49.501","C49.502","C49.504","C76.300x001","C76.300x009","C76.501","C79.500x006","C79.500x009","C79.500x024","C79.500x025","C79.500x030","C79.500x031","C79.500x032","C79.509","D16.600x002","D16.600x003","D16.600x004","D16.600x005","D16.800x001","D16.800x002","D16.800x006","D16.801","D16.802","D16.803","D48.000x028","D48.012","D48.013","D48.014","D48.015","D48.016","D48.017"]
  adrg_zd1 = []
  adrg_ss = ["54.3x03","54.3x05","54.4x00x012","54.4x00x021","54.4x00x035","54.4x00x042","54.4x00x047","54.4x00x055","54.4x02","54.4x07","77.6900x001","77.6900x004","77.6900x025","77.6900x032","77.6900x039","77.6900x055","77.6900x056","77.6900x057","77.6900x058","77.6900x059","77.6900x060","77.6900x061","77.6900x062","77.6900x068","77.6900x069","77.6901","77.6904","77.8900x004","77.8900x017","77.9105","77.9900x003","77.9900x004","77.9901","77.9904","77.9905","78.0900x008","78.0900x009","78.0900x010","78.0900x011","78.0900x012","78.0900x022","78.0900x023","78.0900x024","78.0900x025","78.0900x026","78.0901","78.0904","78.1900x004","78.1901","78.3000","78.4900x007","78.4901","78.5900x022","78.5900x027","78.5900x028","78.5900x029","78.5900x030","78.5901","78.5904","81.4000x007","81.4000x008","81.4001","84.1800","84.1901","84.5500x003","84.5500x004","84.5500x005","84.5501","84.5600x001","84.5601"]
  adrg_ss1 = []
  dept_list = []

  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss:
    message('符合ID1入组条件，匹配规则：主诊断匹配、主手术匹配')

    if MDCI_DRG.ID19_group(record):
      return 'ID19'
        
    return 'ID1'
  else:
    return ''
    
